<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%
  String xm = this.getServletContext().getInitParameter("path");
	String path1 = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/"+xm;
%>   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>更新</title>
  <script type="text/javascript" src="<%=path1%>/scripts/jquery-1.7.2.js"></script>
  <script type="text/javascript" src="<%=path1%>/scripts/pagekage/utils/widget/jqGrid/jquery.jqGrid.src.js"></script>
  <script type="text/javascript" src="<%=path1%>/scripts/pagekage/utils/widget/jqGrid/i18n/grid.locale-cn.js"></script>
  <script type="text/javascript" src="<%=path1%>/scripts/pagekage/utils/widget/jqGrid/jquery.jqGrid.min.js"></script>  
  <script src="<%=path1%>/qt/Scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
  <script src="<%=path1%>/qt/Scripts/IndexManager.js" type="text/javascript"></script>
  <script src="<%=path1%>/qt/Scripts/selectProject.js" type="text/javascript"></script>      

</head>
<script type="text/javascript">
var id,organization_id;
$(document).ready(function(){
	var SeachSql;
	
    var str=window.location.href; //得到listclient的地址
    alert("str"+str);
   
    var es=/id=/; 
    es.exec(str); //得到地址后面变量名称
 //   alert("es--"+es.exec(str));
    var right=RegExp.rightContext;//得到地址后面变量名称的值
 //   alert("right-"+right);
    id=right;
    if(id!="" )
	  {
    	
    	organization_id =id;
	  }
     

	$.ajax({
    	url:"Organization/selectById.do",
        datatype:'json', 
        data:{'organization_id':organization_id}, // 发送数据   
        error:function(data){  
            alert("出错了,没有这个客户！！");  
       },   
   
       success:function(data){
       	$("#organization_name").val(data.rows[0].organization_name),
		$("#organization_address").val(data.rows[0].organization_address);
		$("#organization_tel").val(data.rows[0].organization_tel),
		$("#delete_time").val(data.rows[0].delete_time),
		$("#delete_user").val(data.rows[0].delete_user),
		$("#update_user").val(data.rows[0].update_user),
		$("#udpate_time").val(data.rows[0].udpate_time),
		$("#delete_state").val(data.rows[0].delete_state)
		
       	//var model=data.model;
       }
        });
  
    
});

    function ajaxUpdate(){
    
        $.ajax({ 	
        data: {
        	organization_id:organization_id,
        	organization_name:$("#organization_name").val(),
        	organization_address:$("#organization_address").val(),
        	organization_tel:$("#organization_tel").val(),
        	update_user:$("#update_user").val(),
        	update_time:$("#update_time").val(),
        	delete_user:$("#delete_user").val(),
        	delete_time:$("#delete_time").val(),
        	delete_state:$("#delete_state").val()
        	},  
        	type:"Post",  
        dataType: 'json',  
        url:"Organization/updateOrganization.do", 
        error:function(data){  
             alert("修改出错了！！");  
        },  
        success:function(data){
        	alert('客户信息修改成功！');
        	window.location.href = 'listOrganization.jsp'; 
          }  
         });  
     } 
   
</script>
<body>

 name <input type="text" name="organization_name" id="organization_name"/>
 organization_address <input type="text" id="organization_address"/>
 organization_tel <input type="text" name="organization_tel" id="organization_tel"/>
 update_user <input type="text" name="update_user" id="update_user"/>
 update_time <input type="text" name="update_time" id="update_time"/>
  delete_user<input type="text" name="delete_user" id="delete_user"/>
  delete_time<input type="text" name="delete_time" id="delete_time"/>
  delete_state<input type="text" name="delete_state" id="delete_state"/>
  <input type="button" value="提交" onclick="ajaxUpdate()">
  
</body>
</html>